import { axios } from '~/plugins/axios';

// 获取项目库列表
export const getProjectList = (params?: any) => axios({
  method: 'get',
  url: '/project/list',
  params,
}) as Promise<any>;

// 获取我的项目列表
export const getMyProjectList = (params?: any) => axios({
  method: 'get',
  url: '/project/my_list',
  params,
}) as Promise<any>;

// 获取我的项目抽查列表
export const getMyProjectCheckList = (params?: any) => axios({
  method: 'get',
  url: '/project/audit_list',
  params,
}) as Promise<any>;

// 项目上下架
export const handleShelve = (params?: any) => axios({
  method: 'post',
  url: '/project/shelve',
  data: {
    ...params,
  },
}) as Promise<any>;

// 删除项目
export const handleProjectDelete = (params?: any) => axios({
  method: 'delete',
  url: `/project/${params as string}`,
}) as Promise<any>;

// 咨询
export const handleProjectConsult = (params?: any) => axios({
  method: 'post',
  url: '/action/consulting',
  data: {
    ...params,
  },
}) as Promise<any>;

// 整改
export const handleProjectCheck = (params?: any) => axios({
  method: 'post',
  url: '/action/project_audit',
  data: {
    ...params,
  },
}) as Promise<any>;

// 关注
export const handleStar = (params?: any) => axios({
  method: 'post',
  url: `/action/star_project/${params as string}`,
}) as Promise<any>;

// 取消关注
export const handleCancelStar = (params?: any) => axios({
  method: 'delete',
  url: `/action/star_project/${params as string}`,
}) as Promise<any>;
